<template>
  <div class="box">
    <div>
      <!-- <img src="@/assets/imgs/hxrImg/hxr_rlrz.png" alt="" class="rzcg_img" /> -->
      <img src="@/assets/imgs/hxrImg/hxr_rztg.png" alt="" class="rzcg_img" />
    </div>
    <div class="rzcg_text">认证成功</div>
    <div class="submit" @click="goSubmit">提交</div>
  </div>
</template>
<script>
import {
  idCardAdd,
  id_number,
  idCardRecognition,
} from "@/interfaces/authorize";
export default {
  name: "" /*1. Vue扩展 */,
  extends: "", // extends和mixins都扩展逻辑，需要重点放前面
  mixins: [],
  components: {} /* 2. Vue数据 */,
  props: {},
  model: { prop: "", event: "" }, // model 会使用到 props
  data() {
    return {};
  },
  computed: {},
  watch: {} /* 3. Vue资源 */, // watch 监控的是 props 和 data，有必要时监控computed
  filters: {},
  directives: {} /* 4. Vue生命周期 */,
  created() {},
  mounted() {},
  destroy() {} /* 5. Vue方法 */,
  methods: {
    async goSubmit() {
      console.log(localStorage,'怎么没了')
      let savedObject = JSON.parse(localStorage.getItem("enterpriseObj"));
      console.log(savedObject,'shisha')
      savedObject.orderId = this.getUrlParam("orderNo")
        ? this.getUrlParam("orderNo")
        : "";
     
      let source =localStorage.getItem("qyrz_source")
      let userId = localStorage.getItem("qyrz_userId")
 
      savedObject.userId = userId;
      savedObject.source = source;


      console.log(savedObject, "savedObjectsavedObject");
      
      const res = await idCardAdd(savedObject);
    
      if (res.code == 200) {
        this.$router.push({
          path: "/qyrzSubmitTo",
          query: {},
        });
      }
      //   idCardAdd(savedObject).then((res) => {
      //     console.log(res, "调接口了");
      //   });
    },
    getUrlParam(name) {
      const queryStr = String(window.location).split("?")[1] || "";
      name = encodeURIComponent(name);
      let arr = new RegExp("(^|&)" + name + "=([^&]*)(&|$)").exec(queryStr);
      if (arr) {
        return decodeURIComponent(RegExp.$2);
      } else {
        return "";
      }
    },
  }, // all the methods should be put here in the last
};
</script>
<style scoped lang="scss">
.box {
  width: 100%;
  height: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.rzcg_img {
  width: 150px;
  margin: auto;
  margin-top: -150px;
}
.rzcg_text {
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  margin-top: 20px;
  color: #67c23a;
}
.submit {
  width: 300px;
  height: 50px;
  border-radius: 50px;
  line-height: 50px;
  color: white;
  margin-top: 50px;
  background-color: dodgerblue;
}
</style>
